<template>
  <!--我的账单-->
  <div>
    <span v-if="textType==='time'">{{fTime}}</span>
    <span v-if="textType==='distance'">{{distance}}</span>
  </div>
</template>
<script>
import util from "../../utils/tools";
export default {
  props: {
    valueData: {
      default: "",
      type: String
    },
    textType: {
      default: "",
      type: String
    }
  },
  computed: {
    fTime() {
      return util.formatTime(this.valueData);
    },
    distance() {
      if (this.valueData) {
        if (this.valueData / 1000 < 1) { // 小于1000米
          return this.valueData.toFixed(0) + 'm'
        }
        return (this.valueData / 1000).toFixed(2) + 'km';
      } else {
        return '0m'
      }

    }
  }
};
</script>
